package com.longjoe.ljframework.net.ljwcom;

import com.longjoe.ljframework.net.Request;
import com.longjoe.ljframework.net.combase.ILJRequest;

/**
 * Created by Heycz on 2015/5/20.
 */
public class GetFileRequest implements ILJRequest<GetFileResponse> {


  private String token;

  /**
   * 文件来源 MailAnnex- 邮件附件(Sys_admsg_fj) OADocAnnex- 公文附件(oa_doc_annex) OADemoAnnex-
   * 公文模板附件(oa_demo_annex) OAFlowDefAnnex- 审批流程主模板(oa_flow_annex) UFile- 单据附件(U_File)
   */
  private String type;
  private int id;
  private int width;
  private int height;

  public String getToken() {
    return token;
  }

  public void setToken(String token) {
    this.token = token;
  }

  public String getType() {
    return type;
  }

  public void setType(String type) {
    this.type = type;
  }

  public int getId() {
    return id;
  }

  public void setId(int id) {
    this.id = id;
  }

  public int getWidth() {
    return width;
  }

  public void setWidth(int width) {
    this.width = width;
  }

  public int getHeight() {
    return height;
  }

  public void setHeight(int height) {
    this.height = height;
  }

  /**
   * 根据socket虚拟url得到FileRequest
   *
   * @param url 格式:?method=[type]&token=[token]&id=[id]&height=[height]&width=[width]
   * @return 文件请求
   */
  public static Request get(String url) {
    if (!url.startsWith("sock://")) {
      throw new IllegalArgumentException("url协议错误");
    }
    String tmp = url.replace("sock://", "").replace("?", "");
    return null;
  }

  @Override
  public String GetApiName() {
    return "GetFile";
  }
}
